package alvarodelrosal.chat.client.chataction.local;

import alvarodelrosal.chat.client.chataction.infraestructuraremota.AllChats;
import alvarodelrosal.chat.client.chataction.remote.ChatConversation;
import java.util.List;

public class ChatAllMyChats implements ChatLocalAction {

    @Override
    public String getName() {
        return "AllMyChats";
    }

    @Override
    public void doAction(List<String> parameters) {
        for(int parameter = 0; parameter < parameters.size(); parameter += 2) {
            AllChats.addConversation(Integer.parseInt(parameters.get(parameter)),
                    parameters.get(parameter + 1));
            ChatConversation conversation = new ChatConversation();
            List<String> prepareParameters = conversation.prepareParameters(
                    Integer.parseInt(parameters.get(parameter)));
            conversation.doAction(prepareParameters);
        }
    }
    
}
